# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):
    
    def forwards(self, orm):
        
        # Adding model 'Questionnaire'
        db.create_table('polls_questionnaire', (
            ('code_name', self.gf('django.db.models.fields.CharField')(max_length=256, null=True, blank=True)),
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('language', self.gf('django.db.models.fields.CharField')(default='bg', max_length=2)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=1024, null=True, blank=True)),
        ))
        db.send_create_signal('polls', ['Questionnaire'])

        # Adding model 'Question'
        db.create_table('polls_question', (
            ('is_active', self.gf('django.db.models.fields.BooleanField')(default=True, blank=True)),
            ('position', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
            ('question', self.gf('django.db.models.fields.TextField')()),
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('qtype', self.gf('django.db.models.fields.CharField')(default='text', max_length=20)),
        ))
        db.send_create_signal('polls', ['Question'])

        # Adding model 'QuestionOption'
        db.create_table('polls_questionoption', (
            ('question', self.gf('django.db.models.fields.related.ForeignKey')(related_name='options', to=orm['polls.Question'])),
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('value', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('label', self.gf('django.db.models.fields.TextField')()),
        ))
        db.send_create_signal('polls', ['QuestionOption'])

        # Adding model 'AnswerSet'
        db.create_table('polls_answerset', (
            ('city', self.gf('django.db.models.fields.CharField')(max_length=1024, null=True, blank=True)),
            ('modified_by', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)),
            ('created', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
            ('modified', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
            ('created_by', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)),
            ('email', self.gf('django.db.models.fields.CharField')(max_length=1024, null=True, blank=True)),
            ('phone', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)),
            ('full_name', self.gf('django.db.models.fields.CharField')(max_length=512, null=True, blank=True)),
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
        ))
        db.send_create_signal('polls', ['AnswerSet'])

        # Adding model 'Answer'
        db.create_table('polls_answer', (
            ('answer', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
            ('question', self.gf('django.db.models.fields.related.ForeignKey')(related_name='answers', to=orm['polls.Question'])),
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('answer_set', self.gf('django.db.models.fields.related.ForeignKey')(related_name='answers', to=orm['polls.AnswerSet'])),
        ))
        db.send_create_signal('polls', ['Answer'])
    
    
    def backwards(self, orm):
        
        # Deleting model 'Questionnaire'
        db.delete_table('polls_questionnaire')

        # Deleting model 'Question'
        db.delete_table('polls_question')

        # Deleting model 'QuestionOption'
        db.delete_table('polls_questionoption')

        # Deleting model 'AnswerSet'
        db.delete_table('polls_answerset')

        # Deleting model 'Answer'
        db.delete_table('polls_answer')
    
    
    models = {
        'polls.answer': {
            'Meta': {'object_name': 'Answer'},
            'answer': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
            'answer_set': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'answers'", 'to': "orm['polls.AnswerSet']"}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'question': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'answers'", 'to': "orm['polls.Question']"})
        },
        'polls.answerset': {
            'Meta': {'object_name': 'AnswerSet'},
            'city': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
            'created': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
            'created_by': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
            'email': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
            'full_name': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'modified': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
            'modified_by': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
            'phone': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'})
        },
        'polls.question': {
            'Meta': {'object_name': 'Question'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
            'position': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'qtype': ('django.db.models.fields.CharField', [], {'default': "'text'", 'max_length': '20'}),
            'question': ('django.db.models.fields.TextField', [], {})
        },
        'polls.questionnaire': {
            'Meta': {'object_name': 'Questionnaire'},
            'code_name': ('django.db.models.fields.CharField', [], {'max_length': '256', 'null': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'language': ('django.db.models.fields.CharField', [], {'default': "'bg'", 'max_length': '2'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'})
        },
        'polls.questionoption': {
            'Meta': {'object_name': 'QuestionOption'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'label': ('django.db.models.fields.TextField', [], {}),
            'question': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'options'", 'to': "orm['polls.Question']"}),
            'value': ('django.db.models.fields.CharField', [], {'max_length': '255'})
        }
    }
    
    complete_apps = ['polls']
